package com.xpsoft.oa.dao.produce.impl;


import java.util.List;

import org.hibernate.Query;

import com.xpsoft.core.dao.impl.BaseDaoImpl;
import com.xpsoft.oa.dao.produce.MaterialPurchaseInfoDao;
import com.xpsoft.oa.model.produce.MaterialPurchaseInfo;

public class MaterialPurchaseInfoDaoImpl extends BaseDaoImpl<MaterialPurchaseInfo> implements MaterialPurchaseInfoDao{

	public MaterialPurchaseInfoDaoImpl() {
		super(MaterialPurchaseInfo.class);
	}

	@Override
	public void deleteMaterialPurchaseInfos(Long purchaseId, List<Long> idList) {
		// TODO Auto-generated method stub
		String hql = "delete from MaterialPurchaseInfo where id not in (:ids) and purchasePlan.id=:purchaseId";
		Query query =  getSession().createQuery(hql);
		query.setParameterList("ids", idList).setParameter("purchaseId", purchaseId);
		query.executeUpdate();
	}

}